package protocol.JT808_2019;

import java.util.HashMap;

public class Handle808_2019JT8A implements IHandle808_2019JT {
    @Override
    public String handle(JT808_2019Cmd cmd) {
        byte subOrder = cmd.subOrder();

        switch (subOrder){
            case 0x00:
                return handle8A00(cmd);
            default:
                return "808-2019:未匹配的命令字"+(cmd.readOrder()+","+cmd.readSubOrder());
        }
    }

    private String handle8A00(JT808_2019Cmd cmd) {
        StringBuilder builder = new StringBuilder();
        builder.append("平台->终端:平台RSA公钥");
        builder.append("\r\n");

        builder.append("平台RSA公钥[e,n]中的e:"+cmd.readDWORD());
        builder.append("\r\n");

        builder.append("RSA公钥[e,n]中的n:"+cmd.readBCD(128));
        builder.append("\r\n");

        return builder.toString();
    }
}
